5-E
Simple site for the info you need...
  • Add Local Admin
  • Backup Dogecoin Wallet
  • Batch Start Powershell
  • Copy A File(s) To All Users On A PC
  • CPU Load Test
  • Disable Users
  • Email Group Members
  • Email With Powershell
  • Exchange Total Size
  • Export to XLSX
  • Export User Cert
  • Get System Info
  • Import Active Directory Module
  • Last Login For All Computer
  • Last Login For All Users
  • Last Login For Select Users
  • List Domain controllers
  • List Groups (With Count) In Active Directory To TXT
  • List Groups (With Count) In Active Directory To XLSX
  • List Groups For A User(s)
  • List Groups In Active Directory to TXT
  • List Home Directory
  • List Members In A Group(s)
  • Password Generator
  • Ping Test
  • Printer Reset
  • Run A Process Every Few Minutes
  • Search For Files On All Local Drives
  • Show iSCSI Device And Disk Number
  • Uninstall Java

List Members In Groups

Add groups to the input.txt file and this tool will export the members to a XLSX file.
CODE:
import-module ActiveDirectory 
#create Excel Workbook 
$Excel = New-Object -Com Excel.Application  
$Excel.visible = $True  
$Excel = $Excel.Workbooks.Add()  
$wSheet = $Excel.Worksheets.Item(1)  
$wSheet.Cells.item(1,1) = "Groups:"  
$wSheet.Cells.item(1,2) = "SAM:"  
$wSheet.Cells.Item(1,3) = "Users:"  
$wSheet.Cells.Item(1,4) = "Description:" 
$WorkBook = $wSheet.UsedRange  
$WorkBook.Interior.ColorIndex = 45  
$WorkBook.Font.ColorIndex = 1  
$WorkBook.Font.Bold = $True  
$groups = get-content input.txt 
$intRow = 1 
foreach ($group in $groups) 
{ 
$intRow++ 
$arrMembers = Get-ADGroupMember -Identity $group  
foreach ($member in $arrMembers){ 
$user = get-aduser -identity $member -Properties * 
If ($member.name) 
{ 
$wSheet.Cells.item($intRow,1) = $group 
$wSheet.Cells.item($intRow,2) = $user.samaccountname 
$wSheet.Cells.Item($intRow,3) = $user.name 
$wSheet.Cells.Item($intRow,4) = $user.description 
$intRow++ 
} 
Else 
{ 
} 
} 
} 
Use at your own risk
Input File:
Domain Users
Exchange Admins
GroupWithMembers
Use at your own risk
Download: List Members In A Group(s).zip

Tag(s): Powershell


Could you spare a few coins?
Dogecoin - D838u1m9YRdzVVu8CZ1JsR78WHgQmUZSr8
Bitcoin - 13iKLoPXcWEYcGtqCi4UcjGQEs7r6M6LFc
Thank you
  • Home

  • Batch
  • Email
  • Exchange
  • How To
  • Local PC
  • Powershell
  • Security